//
//  main.m
//  ClassTest
//
//  Created by wangrui on 14-4-11.
//  Copyright (c) 2014年 PPS. All rights reserved.
//

#import <Foundation/Foundation.h>

//========================================
@interface GrandFather : NSObject

- (id)init;

@end

@implementation GrandFather

- (id)init {
    
    if ((self = [super init])) {
        NSLog(@"Grand:%@", NSStringFromClass([self class]));
        NSLog(@"Grand:%@", NSStringFromClass([super class]));
    }
    
    return self;
}

@end

//========================================

@interface Father: GrandFather
{
    
}

- (id)init;

@end

@implementation Father

- (id)init {
    
    if ((self = [super init])) {
        NSLog(@"Father:%@", NSStringFromClass([self class]));
        NSLog(@"Father:%@", NSStringFromClass([super class]));
    }
    
    return self;
}

@end

//========================================

@interface Son : Father
{
    
}

- (id)init;

@end


@implementation Son

- (id)init
{
    self = [super init];
    
    if(self) {
        NSLog(@"Son:%@", NSStringFromClass([self class]));
        NSLog(@"Son:%@", NSStringFromClass([super class]));
    }
    
    return self;  //return [NSString stringWithUTF8String:"5"];
}


@end

//========================================

int main(int argc, const char * argv[])
{

    @autoreleasepool {
        
        Father *father = [Father new];
        BOOL b1 = [father respondsToSelector:@selector(respondsToSelector:)];
        BOOL b2 = [Father respondsToSelector:@selector(respondsToSelector:)];
        
        NSLog(@"%d, %d", b1, b2);
        NSLog(@"%lu",(unsigned long)[Father hash]);
        
        
        
        Son *son = [[Son alloc] init];
        [son description];
        
    }
    
    return 0;
}

